dialog: Avoid possible use-after-free
authorBastien Nocera <hadess@hadess.net>
Mon, 17 Mar 2014 08:27:36 +0000 (09:27 +0100)
committerBastien Nocera <hadess@hadess.net>
Mon, 17 Mar 2014 13:29:10 +0000 (14:29 +0100)
When the dialogue's titlebar was replaced, we were still trying to
update the label we constructed but that was now destroyed.

https://bugzilla.gnome.org/show_bug.cgi?id=726492

gtk/gtkdialog.c

index 3b54c46b004d80042de45f5ad010b3ac27bd628b..19039ba27fd996686fc68e8283670fd0c617c0fa 100644 (file)
@@ -304,7 +304,7 @@ apply_use_header_bar (GtkDialog *dialog)
           label = gtk_label_new ("");
           gtk_style_context_add_class (gtk_widget_get_style_context (label), "title");
           gtk_box_set_center_widget (GTK_BOX (box), label);
-          g_signal_connect (dialog, "notify::title", G_CALLBACK (update_title), label);
+          g_signal_connect_object (dialog, "notify::title", G_CALLBACK (update_title), label, 0);
         }
 
       gtk_window_set_titlebar (GTK_WINDOW (dialog), box);